package com.itheima.tcp;

import java.io.IOException;
import java.io.OutputStream;
import java.net.InetAddress;
import java.net.Socket;

public class Client {

    public static void main(String[] args) throws IOException {

        //创建 客户端对象
        InetAddress ip = InetAddress.getByName("127.0.0.1");

        Socket socket = new Socket(ip,6666);
        //获取输出流
        OutputStream os = socket.getOutputStream();

        //写数据
        os.write("hello,tcp".getBytes());

        //释放资源
        //os.close();
        socket.close();


    }
}
